<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<ui:composition>
	<p:dataTable var="product" value="#{productModel.list}"  filteredValue="#{productModel.filteredList}" filterEvent="enter"
		resizableColumns="false" rowKey="#{product.id}"
		selection="#{productModel.current}" selectionMode="single"  paginator="true"  rows="30" rowsPerPageTemplate="5,7,10,15,20,30,40,50"
		paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}">
		<p:column headerText="Supplier" sortBy="#{product.supplier.name}"
			filterBy="#{product.supplier.name}" filterMatchMode="contains">
			<h:outputText value="#{product.supplier.name}" />
		</p:column>
		<p:column headerText="number" sortBy="#{product.number}"
			filterBy="#{product.number}" filterMatchMode="contains" style="max-width:70px">
			<h:outputText value="#{product.number}" />
		</p:column>
		<p:column headerText="name" sortBy="#{product.name}"
			filterBy="#{product.name}" filterMatchMode="contains">
			<h:outputText value="#{product.name}" />
		</p:column>
		<p:column headerText="type" sortBy="#{product.type.label}"
			filterBy="#{product.type.label}" filterMatchMode="contains" style="max-width:70px">
			<h:outputText value="#{product.type.label}" />
		</p:column>
		<p:column headerText="Special ?" sortBy="#{product.isOnSpecial}"
			filterBy="#{product.isOnSpecial}" filterMatchMode="contains" style="max-width:70px">
			<h:outputText value="#{product.isOnSpecial}" />
		</p:column>
		<p:column headerText="price" sortBy="#{product.price}"
			filterBy="#{product.price}" filterMatchMode="contains" style="max-width:70px">
			<h:outputText value="#{product.price}" />
		</p:column>
		<p:column headerText="Special" sortBy="#{product.specialPrice}"
			filterBy="#{product.specialPrice}" filterMatchMode="contains" style="max-width:70px">
			<h:outputText value="#{product.specialPrice}" />
		</p:column>
		<p:column headerText="Unit" sortBy="#{product.priceUnitLabel}"
			filterBy="#{product.priceUnitLabel}" filterMatchMode="contains" style="max-width:70px">
			<h:outputText value="#{product.priceUnitLabel}" />
		</p:column>
		<p:column headerText="Unit price" sortBy="#{product.unitPriceLabel}"
			filterBy="#{product.unitPriceLabel}" filterMatchMode="contains" style="max-width:70px">
			<h:outputText value="#{product.unitPriceLabel}" />
		</p:column>
		<p:column style="width:20px">
			<p:commandButton icon="edit" ajax="true"
				oncomplete="editPriceDlg.show()" update=":dialogForm">
				<f:setPropertyActionListener value="#{product}"
					target="#{productModel.current}" />
			</p:commandButton>
		</p:column>
	</p:dataTable>
</ui:composition>
</html>